package com.ai.demo.controller;

import com.ai.demo.service.McpClientServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class McpClientController {
    @Autowired
    private McpClientServer mcpClientServer;

    @GetMapping("/hotnews")
    public String getHotNews() {
        return mcpClientServer.fetchHotNews();
    }

    //@GetMapping(value = "/fetchHotNewsByChatClient", produces = "application/json;charset=UTF-8")
    @GetMapping(value = "/fetchHotNewsByChatClient", produces = "text/plain;charset=UTF-8")
    public Flux<String> fetchHotNewsByChatClient(String userInput) {
        return mcpClientServer.fetchHotNewsByChatClient(userInput);
    }

}
